<?php

namespace App\Http\Resources\Mini\PlatformAgentResource;

use Illuminate\Http\Resources\Json\ResourceCollection;

class PlatformAgentClassCollection extends ResourceCollection
{
    /**
     * Transform the resource into an array.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return array
     */
    public function toArray($request): array
    {
        return [
            'data' => $this->collection->map(function ($item) {
                return [
                    'id' => $item->id,
                    'agent_name' => $item->agent_name,//用户名
                    'agent_mobile' => $item->agent_mobile,//手机号
                    'province' => $item->province,//省份
                    'city' => $item->city,//市
                    'area' => $item->area,//区域
                    'detail' => $item->detail,//详细地址
                    'agent_type' => $item->agent_type,//账户类型
                    'wechat_account_type' => $item->wechat_account_type,//微信账户类型
                    'wechat_account' => $item->wechat_account,//微信账户
                    'alipay_account_type' => $item->alipay_account_type,//支付宝账户类型
                    'alipay_account' => $item->alipay_account,//支付宝账户
                    'agent_admin_id' => $item->agent_admin_id,//绑定管理员id
                    'wechat_account_type_id' => $item->wechat_account_type_id,//微信账户类型id
                    'alipay_account_type_id' => $item->alipay_account_type_id,//支付宝账户类型id
                    'sub_mch_id' => $item->sub_mch_id,//子商户id
                    'alipay_name' => $item->alipay_name,//支付宝收款人
                    'split_type' => $item->split_type,//分账类型
                    'bank_card_number' => $item->bank_card_number,//银行卡号
                    'account_bank' => $item->account_bank,//开户行
                    'is_examine' => $item->is_examine,//是否需要审核
                    'bank_user_name' => $item->bank_user_name,//银行收款人
                    'rate' => $item->rate,//微信手续费比例
                    'rate2' => $item->rate2,//水费报警方案
                    'else_discount' => $item->else_discount,//额外手续费
                    'create_time' => $item->create_time,
                    'update_time' => $item->update_time,
                ];
            }),
        ];
    }
}
